import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

class TextRoute extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('文本及样式'),
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: <Widget>[
          Text(
            'Hello world',
            textAlign: TextAlign.center,
          ),
          Text(
            'Hello world! I\'m Jack.' * 4,
            maxLines: 1,
            overflow: TextOverflow.ellipsis,
          ),
          Text(
            'Hello world',
            textScaleFactor: 1.5,
          ),
          Text(
            'Hello world',
            style: TextStyle(
              color: Colors.blue,
              fontSize: 18,
              height: 1.2,
              fontFamily: 'Courier',
              background: Paint()..color = Colors.yellow,
              decoration: TextDecoration.underline,
              decorationStyle: TextDecorationStyle.dashed,
            ),
          ),
          Text.rich(TextSpan(children: [
            TextSpan(text: 'Home: '),
            TextSpan(text: 'https://flutterchina.club', style: TextStyle(color: Colors.blue)),
          ])),
          DefaultTextStyle(
              style: TextStyle(color: Colors.red, fontSize: 20),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text('hello world'),
                  Text('I am Jack'),
                  Text(
                    'I am Jack',
                    style: TextStyle(
                      inherit: false,
                      color: Colors.grey,
                    ),
                  )
                ],
              )),
        ],
      ),
    );
  }
}
